import os, sys

def open_file(f):
	"""
	EasySVN calls this function to attempt to open a file with
	filename f.

	It should return True if the file was opened, or False
	if EasySVN should try to open the file using another editor.
	"""
	# Here's how opening a .map might work:
	if get_extension(f) == 'map':
		name = os.path.basename(f)[-4]
		launch(
			# command to run
			"python tilemapMaker.py "+name,
			# working directory for command
			os.path.join(working_copy_path, 'src'))

		# Return True to let EasySVN know you opened the file.
		return True
	elif get_extension(f) ('png','gif','jpg','jpeg','xfc'):
		launch(
			"gimp "+f,
			os.path.join(working_copy_path, 'images'))

	# Return False to use the default file opening action.
	return False

def run_game():
	"""
	Example of a working-copy command.	This function is included
	in the WORKING_COPY_COMMANDS tuple below, so it will be
	displayed
	"""
	launch("python main.py", os.path.join(working_copy_path, 'src'))

WORKING_COPY_COMMANDS = (
		("Run Game",			 # Button title.
		 "Launch Roy.",		# Help text under button.
		 run_game),				# Function to call when button is clicked.
)
